<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<%--班级名称、班主任名称、非本班学生、本班学生、备注--%>
<%--上面的讯息都可以进行修改和编辑--%>
<%--参照teachBatchAddForm.jsp--%>
<%--参照recourceCourseForm.jsp--%>
<head>
    <title>班级复制</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">

        $(document).ready(function() {
            //$("#name").focus();
            $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });

        function checkClassId() {
            var classId=document.getElementById("userId").value;
            var duallist=document.getElementById("duallist").value;
            if(classId==null || classId==""){
                window.alertx("请选择班主任！");
                return false;
            }
            if(duallist==null || duallist==""){
                window.alertx(duallist);
                window.alertx("请选择学生！");
                return false;
            }
        }
    </script>

    <script type="text/javascript" src="${path}/js/common/jquery.min.js"></script>
    <link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all">
    <link rel="stylesheet" href="${path}/css/common/bootstrap-duallistbox.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${path}/js/common/jquery.bootstrap-duallistbox.js"></script>

    <style>
        .control-label{font-weight: normal;}
        #className{ height: 30px;}
    </style>
</head>


<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/teach/teachClass/">班级列表</a></li>
    <%--<li class="active"><a href="${ctx}/teach/teachClass/copyClassForm">班级复制/修改</a></li>--%>
    <%--复制和修改的界面是差不多的--%>
    <li class="active"><a href="${ctx}/teach/teachClass/copyClassForm?id=${teachClass.id}">班级<c:choose><c:when test="${not empty type}">复制</c:when><c:otherwise>${not empty teachClass.id?'修改':'添加'}</c:otherwise></c:choose></a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="teachClass" action="${ctx}/teach/teachClass/copyClass" method="post" class="form-horizontal">
    <sys:message content="${message}"/>
    <form:hidden path="id"/>
    <input type="hidden" name="type" id="type" value="${type}">
    <input type="hidden" name="className00" id="className00" value="${className00}">
    <%--<sys:message content="${message}"/>--%>
    <div class="control-group">
        <label class="control-label">班级名称：</label>
        <div class="controls">
            <%--<form:input name="className" path="className"  htmlEscape="false" maxlength="64" class="input-xlarge required" readonly="true"/>--%>
            <form:input name="className" path="className"  htmlEscape="false" maxlength="64" class="input-xlarge required"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">班主任名称：</label>
        <div class="controls">
                <%--<select id="userId" name="userId" class="required input-medium" >--%>
                <%--<option value="" selected>====请选择====</option>--%>
                <%--<c:forEach items="${allTeacherList}" var="allTeacher">--%>
                <%--<option value="${allTeacher.id}" >${allTeacher.name}</option>--%>
                <%--</c:forEach>--%>
                <%--</select>--%>

            <form:select id="userId" path="userId" class="required input-medium">
                <c:forEach items="${allTeacherList}" var="allTeacher">
                    <form:option value="${allTeacher.id}" label="${allTeacher.name}"/>
                </c:forEach>
            </form:select>
        </div>


    </div>
    <div class="control-group">
        <label class="control-label">选择学生：</label>
        <div class="controls">
            <div class="container"></div>
            <div class="col-lg-10 col-md-9 col-sm-9 col-xs-12">

                <select multiple="multiple" size="10" id="duallist" name="duallist" class="resetDuallist">


                    <c:forEach var="allStudentList" items="${allStudentList}">
                        <%--<option value="${allStudentList.id}" <c:if test="${allStudentList.isChoose=='true'}">selected</c:if>>${allStudentList.name}</option>--%>
                        <option value="${allStudentList.id}" <c:if test="${allStudentList.isChoose=='true'}">selected</c:if>>${allStudentList.name}</option>
                    </c:forEach>

                </select>
            </div>
            <span class="help-inline" ><font color="red">*</font> </span>

        </div>
    </div>
    <div class="control-group">
        <label class="control-label">备注信息：</label>
        <div class="controls">
            <form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
        </div>
    </div>
    <div class="form-actions">
        <shiro:hasPermission name="teach:teachClass:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick="return checkClassId()"/>&nbsp;</shiro:hasPermission>
            <%--<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>--%>
        <a class="btn" href="${ctx}/teach/teachClass/">返回</a>
    </div>
</form:form>


<script>
    var demo1 = $('select[class="resetDuallist"]').bootstrapDualListbox();
    $("#demoform").submit(function() {
        alert($('[class="resetDuallist"]').val());
        return false;
    });
</script>
</body>



</html>